
Use NEXUS_DB

GO
--------------------------------------Insert---------------
CREATE PROC insertOrder
	@OrderID varchar(11),
	@Date datetime ,
	@Status int ,
	@CustomerID int ,
	@StoreID int 
AS
INSERT INTO  [Order](OrderID,Date,Status,CustomerID,StoreID)
 VALUES(@OrderID,@Date,@Status,@CustomerID,@StoreID)

GO
---------------------------------------------------update-------------------
CREATE PROC updateOrder
	@OrderID varchar(11),
	@Date datetime ,
	@Status int ,
	@CustomerID int ,
	@StoreID int 
AS
UPDATE [Order] SET	
	Date=@Date,
	Status =@Status,
	CustomerID =@CustomerID,
	StoreID =@StoreID
WHERE OrderID=@OrderID
GO
---------------------------------------------------updateStatusOrders-------------------
CREATE PROC updateStatusOrders
	@OrderID varchar(11),
	@Status int 
AS
UPDATE [Order] SET	
	Status =@Status
WHERE OrderID=@OrderID
GO
---------------------------------------Delete--------------------

CREATE PROC deleteOrder
	@OrderID varchar(11)
AS
	DELETE FROM [Order] WHERE OrderID=@OrderID
GO
------------------------------------------getAll--------------------------
CREATE PROC getAllOrder
AS
SELECT     [Order].*,Custormer.CustomerFullName
FROM         [Order] INNER JOIN
                      Custormer ON [Order].CustomerID = Custormer.CustomerID
GO

------------------------------------------getOrderByID------------
CREATE PROC getOrderByID
	@OrderID varchar(11)
AS
SELECT     [Order].*, Custormer.CustomerFullName,Custormer.CustomerID
FROM         [Order] INNER JOIN
                      Custormer ON [Order].CustomerID = Custormer.CustomerID
WHERE OrderID=@OrderID

